package com.qire.manhua.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import com.qire.common.support.base.BaseDialog;
import com.qire.common.utils.ThemeUtil;
import com.qire.manhua.R;
import com.qire.manhua.databinding.LayoutComicCommentOptionMenuBinding;

/**
 * 漫画评论选项菜单：复制选项、评论回复选项、评论举报选项等
 */
public class ComicCommentOptionMenu extends BaseDialog {

    private final LayoutComicCommentOptionMenuBinding binding;

    private View.OnClickListener complaintListener;
    private View.OnClickListener replyListener;
    private View.OnClickListener copyListener;

    public ComicCommentOptionMenu(Context context) {
        super(context, R.style.BottomDialog);
        binding = LayoutComicCommentOptionMenuBinding.inflate(LayoutInflater.from(context));
        binding.setComicCommentOptionMenu(this);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(binding.getRoot());
        ThemeUtil.setWindowGravityBottom(getWindow(), WindowManager.LayoutParams.WRAP_CONTENT);
    }

    public ComicCommentOptionMenu setComplaintListener(View.OnClickListener listener) {
        complaintListener = listener;
        return this;
    }
    public ComicCommentOptionMenu setReplyListener(View.OnClickListener listener) {
        replyListener = listener;
        return this;
    }
    public ComicCommentOptionMenu setCopyListener(View.OnClickListener listener) {
        copyListener = listener;
        return this;
    }

    public void cancelBtnOnClick(View view){
        dismiss();
    }

    public void complaintBtnOnClick(View view){
        if(complaintListener != null) {
            complaintListener.onClick(view);
        }
        dismiss();
    }

    public void replyBtnOnClick(View view){
        if(replyListener != null) {
            replyListener.onClick(view);
        }
        dismiss();
    }

    public void copyBtnOnClick(View view) {
        if(copyListener != null) {
            copyListener.onClick(view);
        }
        dismiss();
    }

}
